from pymysql import Connection

conn = Connection(
    host='localhost',
    port=3306,
    user='root',
    password='123456',
    autocommit=True,
)
cursor = conn.cursor()  # 获取游标对象
conn.select_db("lyl")
cursor.execute("drop table person;")
cursor.execute("create table person(username varchar(20),age int,sex char(4),high int);")
for i in range(1, 11):
    cursor.execute("insert into person values('悟空',18,'男',190 )")
# conn.commit()
cursor.execute("select*from person")
results = cursor.fetchall()
for r in results:
    print(r)
cursor.close()
conn.close()